﻿<%@ Page Language="C#" MasterPageFile="~/Template.master" AutoEventWireup="true" CodeFile="ThayDoiMatKhau.aspx.cs" Inherits="ThayDoiMatKhau" Title="Untitled Page" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" Runat="Server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
<script type="text/javascript">
    $(document).ready( function()
    {
        var checkPass=0;
        $("#ctl00_ContentPlaceHolder1_txtCurrentPass").keyup(function()
        {
            if($("#ctl00_ContentPlaceHolder1_txtCurrentPass").attr("value")!="")
                $("#currentPassErr").html("");
        });
        $("#ctl00_ContentPlaceHolder1_txtNewPass").keyup(function()
        {
            if($("#ctl00_ContentPlaceHolder1_txtNewPass").attr("value")!="")
                $("#newPassErr").html("");
        });
        $("#ctl00_ContentPlaceHolder1_txtRetypePass").keyup(function ()
	    {
	        var pass=$("#ctl00_ContentPlaceHolder1_txtNewPass").attr("value");
	        var rePass=$("#ctl00_ContentPlaceHolder1_txtRetypePass").attr("value");
	        if(pass!=rePass)
	        {
	            $("#retypePassErr").html("<span class='invalidMessage'>Mật khẩu mới không trùng nhau</span>");
	            checkPass=1;
	        }
	        else if(pass==rePass&&pass!="")
	        {
	            $("#retypePassErr").html("<span class='validMessage'>Hợp Lệ</span>");
	            checkPass=0;
	        }
    	       
	    });
        $("#ctl00_ContentPlaceHolder1_btnSubmit").click(function ()
	    {
	        var check=0;
	        if($("#ctl00_ContentPlaceHolder1_txtCurrentPass").attr("value")=="")
	        {
	            $("#currentPassErr").html("<span class='style4'>Bạn chưa nhập mật khẩu</span>");
	            check=1;
	        }
	        if($("#ctl00_ContentPlaceHolder1_txtNewPass").attr("value")=="")
	        { 
	            $("#newPassErr").html("<span class='style4'>Bạn chưa nhập mật khẩu mới</span>");
	            check=1;
	        }
	        if(check==1||checkPass==1)
	        {
	            alert("Thông tin trong form chưa hợp lệ!!!");
	            return false;
	        }
	        return true;
	    });
    });
</script>
    <asp:Label runat="server" ID="lbContent">
     <table style="font-weight:bold" border="0" align="center" cellpadding="4" cellspacing="0">
      <tr align="center">
        <td colspan="2" class="table_header">Cập nhật mật khẩu</td>
      </tr>
      <tr>
        <td>Mật khẩu hiện tại:</td>
        <td ><asp:TextBox runat="server" name="txtCurrentPass" ID="txtCurrentPass" TextMode="Password" class="textfield"></asp:TextBox>
            <div id="currentPassErr"></div>
            <asp:Label runat="server" ID="passWrongErr"></asp:Label>
        </td>
      </tr>
       <tr>
        <td>Mật khẩu mới:</td>
        <td ><asp:TextBox runat="server" name="txtNewPass" ID="txtNewPass" TextMode="Password" class="textfield"></asp:TextBox>
          <div id="newPassErr"></div>
        </td>
      </tr>      
      <tr>
        <td>Gõ lại mật khẩu mới:</td>
        <td ><asp:TextBox runat="server" name="txtRetypePass" ID="txtRetypePass" TextMode="Password" class="textfield"></asp:TextBox>
               <div id="retypePassErr"></div>
        </td>
      </tr>
      <tr>
        <td></td>
        <td >
            <asp:Button runat="server" ID="btnSubmit" UseSubmitBehavior="true" 
                Text="Cập nhật" onclick="btnSubmit_Click"/>&nbsp;
            <asp:Button runat="server" ID="btnBack" Text="Quay lại" 
                onclick="btnBack_Click" />
        </td>
      </tr>
    </table></asp:Label>
</asp:Content>

